{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/containers/FindUsers.tsx\",\n  _s = $RefreshSig$();\nimport React from \"react\";\nimport { FindUsers as FindUsersList } from \"../components/\";\nimport { UserService } from \"../services\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst FindUsers = props => {\n  _s();\n  const [usersList, setUsersList] = React.useState({\n    items: []\n  });\n  const [inputValue, setInputValue] = React.useState('');\n  React.useEffect(() => {\n    if (usersList.items && usersList.items.length > 0 && inputValue.length > 0) {\n      props.setHaveUsers(true);\n    } else {\n      props.setHaveUsers(false);\n    }\n  }, [usersList, inputValue]);\n  const onChangeInput = function () {\n    let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n    if (value.length !== 0) {\n      (async function () {\n        await UserService.FindUsers({\n          searchValue: value\n        }).then(res => {\n          if (res.status === 200) {\n            setUsersList({\n              ...usersList,\n              items: res.data.items\n            });\n          }\n        });\n      })();\n    } else {\n      setUsersList({\n        items: []\n      });\n    }\n    setInputValue(value);\n  };\n  return /*#__PURE__*/_jsxDEV(FindUsersList, {\n    users: usersList,\n    onSearch: onChangeInput,\n    inputValue: inputValue\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 42,\n    columnNumber: 12\n  }, this);\n};\n_s(FindUsers, \"W7nqOAda0EQ3PVObAJ/5lkBjwt4=\");\n_c = FindUsers;\nexport default FindUsers;\nvar _c;\n$RefreshReg$(_c, \"FindUsers\");","map":{"version":3,"names":["React","FindUsers","FindUsersList","UserService","props","usersList","setUsersList","useState","items","inputValue","setInputValue","useEffect","length","setHaveUsers","onChangeInput","value","searchValue","then","res","status","data"],"sources":["/data/messenger.client/src/containers/FindUsers.tsx"],"sourcesContent":["import React from \"react\";\nimport {FindUsers as FindUsersList} from \"../components/\";\nimport {UsersListResponse} from \"../models/response/UsersListResponse\";\nimport {UserService} from \"../services\";\n\nexport interface FindUsersContainerProps {\n    setHaveContacts: (status: boolean) => void;\n    setHaveUsers: (status: boolean) => void;\n}\n\nconst FindUsers:React.FC<FindUsersContainerProps> = (props) => {\n    const [usersList, setUsersList] = React.useState<UsersListResponse>({items: []});\n    const [inputValue, setInputValue] = React.useState<string>('');\n\n    React.useEffect(() => {\n        if (usersList.items && usersList.items.length > 0 && inputValue.length > 0) {\n            props.setHaveUsers(true);\n        } else {\n            props.setHaveUsers(false);\n        }\n    }, [usersList, inputValue]);\n\n    const onChangeInput = (value: string = '') => {\n        if (value.length !== 0) {\n            (async function() {\n                await UserService.FindUsers({searchValue: value}).then((res: any) => {\n                    if (res.status === 200) {\n                        setUsersList({\n                            ...usersList,\n                            items: res.data.items\n                        });\n                    }\n                });\n            })()\n        } else {\n            setUsersList({items: []});\n        }\n\n        setInputValue(value);\n    };\n\n    return <FindUsersList\n        users={usersList}\n        onSearch={onChangeInput}\n        inputValue={inputValue}\n    />;\n\n};\n\nexport default FindUsers;"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,SAAS,IAAIC,aAAa,QAAO,gBAAgB;AAEzD,SAAQC,WAAW,QAAO,aAAa;AAAC;AAOxC,MAAMF,SAA2C,GAAIG,KAAK,IAAK;EAAA;EAC3D,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAAoB;IAACC,KAAK,EAAE;EAAE,CAAC,CAAC;EAChF,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGV,KAAK,CAACO,QAAQ,CAAS,EAAE,CAAC;EAE9DP,KAAK,CAACW,SAAS,CAAC,MAAM;IAClB,IAAIN,SAAS,CAACG,KAAK,IAAIH,SAAS,CAACG,KAAK,CAACI,MAAM,GAAG,CAAC,IAAIH,UAAU,CAACG,MAAM,GAAG,CAAC,EAAE;MACxER,KAAK,CAACS,YAAY,CAAC,IAAI,CAAC;IAC5B,CAAC,MAAM;MACHT,KAAK,CAACS,YAAY,CAAC,KAAK,CAAC;IAC7B;EACJ,CAAC,EAAE,CAACR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